var PaymentHistory = {

    selected_row_id: null,
    objGrid: null,

    init: function () {
        var self = this;

        self.objGrid = $('#flex').flexigrid({
            colModel: [
                {display: 'Date', width: 80,align: 'left'},
                {display: 'Student Name', width: 150,align: 'left'},
                {display: 'Index Number', width: 80, align: 'center'},
                {display: 'Fee Type', width: 150, align: 'left'},
                {display: 'Fee Code', width: 60, align: 'left'},
                {display: 'Fee Amount GHc', width: 130, align: 'center'},
                {display: 'Total Paid GHc', width: 130, align: 'center'},
                {display: 'Balance GHc', width: 130, align: 'center'}
            ],
            height:500,
            subgrid: {
                use: false
            }
        });

        $("#export-btn").click(function () {
            self.print_export_Details('export');
        });
        $("#print-btn").click(function () {
            self.print_export_Details('print');
        });

        $("#start_dt,#end_dt").mask("9999-99-99");
    },

    print_export_Details: function(data_type){
        $("#print-export-form #data_type").val(data_type);
        $("#print-export-form #data_start_dt").val($("#form-query #start_dt").val());
        $("#print-export-form #data_end_dt").val($("#form-query #end_dt").val());
        $("#print-export-form #data_fee_type").val($("#form-query #fee_type").val());
        $("#print-export-form #data_index_no").val($("#form-query #index_no").val());
        $("#print-export-form #data_session").val($("#form-query #academic_session").val());
        //$("#print-export-form #data_omc_name").val($("#form-query #omc option:selected").text());
        window.open('', "PrintExportWindow", "menubar=yes, width=600, height=500,location=no,status=no,scrollbars=yes,resizable=yes");
        $("#print-export-form").submit();
    }
};

/* when the page is loaded */
$(document).ready(function () {
    PaymentHistory.init();
});